package cn.felord.security.cloud.oauth2.resource.server.autoconfigure.handler;


public class RestBody <T>{
    private int code = 200;
    private T data;
    private String msg = "";
    private boolean identifier = true;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isIdentifier() {
        return identifier;
    }

    public void setIdentifier(boolean identifier) {
        this.identifier = identifier;
    }

    public static <T> RestBody<T> build(int httpStatus, T data, String msg, boolean identifier) {
        RestBody<T> restBody = new  RestBody<>();
        restBody.setCode(httpStatus);
        restBody.setData(data);
        restBody.setMsg(msg);
        restBody.setIdentifier(identifier);
        return restBody;
    }
}
